#define _CRT_SECURE_NO_WARNINGS 1

//#include<stdio.h>
//
//int main()
//{
//	int n = 0;
//	char ch;
//	for (ch = getchar();ch != '\n';n++);
//	printf("%d", n);
//	return 0;
//}

#include<stdio.h>
#include<string.h>
int main()
{
    int n = 0;
    scanf("%d\n", &n);
    int i = 0, j = 0;
    int dx = 0;
    int xx = 0;
    int shuzi = 0;
    for (i = 0;i < n;i++)
    {
        char c[100] = "0";
        gets(c);
        int sz = strlen(c);
        for (j = 0;j < sz;j++)
        {
            if (c[0] >= '0' && c[0] <= '9')
            {
                break;
            }
            else if (sz < 8)
            {
                break;
            }
            else if (c[j] >= 'a' && c[j] <= 'z')
            {
                xx++;
            }
            else if (c[j] >= 'A' && c[j] <= 'Z')
                dx++;
            else if (c[j] >= '0' && c[j] <= '9')
                shuzi++;
        }
        if ((shuzi+dx+xx) == sz && (dx != 0 && xx != 0)||( shuzi != 0&& xx != 0)||(shuzi != 0&& dx != 0))
        {
                printf("YES\n");
        }
        else
        {
            printf("NO\n");
        }

    }

    return 0;
}

